<template>
	<view>
		<view class="share">
			<!-- 弹出背景灰色 -->
			<view :class="{'box': share}" @click="display"></view>
			<!-- 弹出部分 -->
			<view class="share-item" :class="{'show': share}"
				:style="{'height':height + 'rpx','border-radius':borderRadius}">
				<slot name="spOne"></slot>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			//默认不弹出
			share: {
				type: Boolean,
				default: false
			},
			height: {
				type: String,
				default: '700'
			},
			borderRadius: {
				type: String,
				default: ''
			}
		},
		methods: {
			// 隐藏分享
			display() {
				//this.share = !this.share;
				this.$emit('display', this.share)
			}
		}
	}
</script>

<style lang="scss" scoped>
	.share {
		width: 100%;
		height: 100%;
		position: relative;
		// z-index: 1;
	}

	//背景色（黑色透明40%）
	.box {
		width: 100%;
		height: 100%;
		position: fixed;
		top: 0rpx;
		left: 0rpx;
		bottom: 0rpx;
		right: 0rpx;
		background-color: rgba(0, 0, 0, 0.4);
		transition: .3s;
		z-index: 999;
	}

	// 进入分享动画
	.show {
		transition: all 0.3s ease;
		transform: translateY(0%) !important;
	}

	// 离开分享动画
	.share-item {
		position: fixed;
		left: 0;
		bottom: 0;
		width: 100%;
		// height: 1000rpx;
		background-color: #FFFFFF;
		transition: all 0.3s ease;
		transform: translateY(100%);
		z-index: 999;
	}
</style>